import request from '@/utils/request'

// 签到
export function sign() {
  return request({
    url: '/checkWork/sign',
    method: 'get'
  })
}
// 查询
export function getSignRecord(data, offset, limit) {
  return request({
    url: '/checkWork',
    method: 'get',
    params: {
      begin: data.begin,
      end: data.end,
      status: data.status,
      offset: offset,
      limit: limit
    }
  })
}
export function getLeaveRecord(data, offset, limit) {
  return request({
    url: '/leave',
    method: 'get',
    params: {
      begin: data.begin,
      end: data.end,
      status: data.status,
      offset: offset,
      limit: limit
    }
  })
}
export function getOvertimeRecord(data, offset, limit) {
  return request({
    url: '/overtime',
    method: 'get',
    params: {
      begin: data.begin,
      end: data.end,
      status: data.status,
      offset: offset,
      limit: limit
    }
  })
}
export function getComplementRecord(data, offset, limit) {
  return request({
    url: '/checkWork/complementSign',
    method: 'get',
    params: {
      begin: data.begin,
      end: data.end,
      status: data.status,
      offset: offset,
      limit: limit
    }
  })
}
// 申请
export function addLeave(data) {
  return request({
    url: `/leave`,
    method: 'post',
    data
  })
}
export function addOvertime(data) {
  return request({
    url: `/overtime`,
    method: 'post',
    data
  })
}
export function addComplementSign(data) {
  return request({
    url: `/checkWork/complementSign`,
    method: 'post',
    data
  })
}
// 修改状态
export function modifyLeaveStatus(id, status) {
  return request({
    url: `/leave/status/${id}`,
    method: 'put'
  })
}
export function modifyOvertimeStatus(id, status) {
  return request({
    url: `/overtime/status/${id}`,
    method: 'put'
  })
}
export function modifyComplementStatus(id, status) {
  return request({
    url: `/checkWork/status/${id}`,
    method: 'put'
  })
}

